package beanUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.beanutils.BeanUtils;

public class BeanUtilClass {

	public static void populateBean(Object bean,HttpServletRequest request)
	{
		populateBean(bean, request.getParameterMap());
	}
	
	public static void populateBean(Object bean, Map requestParameters)
	{
		try 
		{
			BeanUtils.populate(bean, requestParameters);
		}
		catch (IllegalAccessException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (InvocationTargetException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
